import useRequest from "@/api/useRequest";
import {IPage} from "@/interface/modules/system";
import {AxiosProgressEvent} from "axios";
export class promptControllerApi {

  /**
   * 获取StableDiffusion提示词
   * @param parentId
   */
  static getStableDiffusion(parentId:string): Promise<any> {
    return useRequest({
      url: "/tag/tagCategory/getCategoryByParentId?parentId="+parentId,
      method: "get"
    })
  }

    /**
     * 获取gpt提示词
     */
  static getGptPrompt(data: any, pagination?: IPage):Promise<any>{
    return useRequest({
      url: "/gptPrompt/getPromptList",
      method: "post",
      params: pagination,
      data
    })
  }

  /**
   * 获取绘画风格
   * @param paintType
   */
  static getPaintStyleOption(paintType:string): Promise<any> {
    return useRequest({
      url: "/paintPromptTemplate/list?type="+paintType,
      method: "get"
    })
  }


  static saveGptPrompt(data: any):Promise<any>{
    return useRequest({
      url: "/gptPrompt/save",
      method: "post",
      data
    })
  }

  static deleteGptPrompt(id: string):Promise<any>{
    return useRequest({
      url: "/gptPrompt/delete/"+id,
      method: "get"
    })
  }

  static updateGptPrompt(data: any):Promise<any>{
    return useRequest({
      url: "/gptPrompt/update",
      method: "post",
      data
    })
  }


  static getGptPromptOption(templateCode: string):Promise<any>{
    return useRequest({
      url: "/gptPrompt/getPromptByTemplateCode?templateCode="+templateCode,
      method: "get"
    })
  }

  static commonReason(data:any,downloadProgress:any):Promise<any>{
    return useRequest({
      url: '/gpt/commonReason',
      data,
      method: "post",
      onDownloadProgress: downloadProgress
    });
  }
}
